package com.scaffold.manager.impl;

import com.scaffold.dao.UserDao;
import com.scaffold.manager.UserManager;
import com.scaffold.model.domain.UserDO;
import com.scaffold.model.param.UserListParam;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Da Shuai
 * @since 2021-08-21 16:19:04
 */
@Component
@RequiredArgsConstructor
public class UserManagerImpl implements UserManager {

    private final UserDao userDao;

    @Override
    public void saveUser(UserDO user) {
        userDao.insert(user);
    }

    @Override
    public void deleteUserById(Long id) {
        userDao.deleteById(id);
    }

    @Override
    public void updateUser(UserDO user) {
        assert user.getId() != null;
        userDao.updateById(user);
    }

    @Override
    public UserDO getUserById(Long id) {
        return userDao.selectById(id);
    }

    @Override
    public UserDO getUserIncludeDeleteById(Long id) {
        return userDao.getUserIncludeDeleteById(id);
    }

    @Override
    public List<UserDO> listUser(UserListParam param) {
        return null;
    }
}
